Due: Friday, May 22nd by 6:00 PM
Write up carefully argued solutions to the following problems. Each solution should be clear enough that it can explain (to someone who does not already understand the answer) why it works. However, you may use results from lecture, the reference sheets, and previous homework without proof.
You are required to submit your own solutions. You are allowed to discuss the homework with other students. However, the write up must clearly be your own, and moreover, you must be able to explain your solution at any time. We reserve ourselves the right to ask you to explain your work at any time in the course of this class.
You have a total of three late days during the quarter, but you can only use one late day on any one homework, giving an additional day on both parts. Please plan ahead.
Submit your solution via Gradescope. In particular:
Each numbered task should be solved on its own page (or pages). Do not write your name on the individual pages. (Gradescope will handle that.)
When you upload your pages, make sure each one is properly rotated. If not, you can use the Gradescope controls to turn them to the proper orientation.
Follow the Gradescope prompt to link tasks to pages.
You are not required to typeset your solution, but your submission must be legible. It is your responsibility to make sure solutions are readable — we will not grade unreadable write-ups.
For each of the relations below, determine whether or not it has each of the properties of reflexivity, symmetry, antisymmetry, and/or transitivity. If a relation has a property, simply say so without any further explanation. If a relation does not have a property, state a counterexample, but do not explain your counterexample further.
Define by iff is odd.
Define by iff .
Let be the set of negative integers. Define by iff
Let . Define by iff . (Remember that .)
Hint: What can be in ? What can’t be?
Let be a relation on a set . Recall from lecture the definition of the composition of two relations:
and “ is transitive” iff
and “ is antisymmetric” iff
The definition of antisymmetric is different from the one in the lecture, but it is equivalent. Using this definition can make the proof slightly easier.
Now, consider the following claim:
Given that is transitive and antisymmetric, it follows that is antisymmetric.
Write an English proof that the claim holds.
Note: Even though we want you to write your proof directly in English, it must still look like the translation of a formal proof. In particular, you must include all steps that would be required of a formal proof, excepting only those that we have explicitly said are okay to skip in English proofs (e.g., Elim ).
Let , and consider the following language:
That is,
is the language consisting of all binary strings that have an even number of ’s and an even number of ’s.Give a DFA that recognizes . For each state, write a short description of the set of strings that end in that state.
Give a regular expression that matches . Try to give it some thought before reading the hint1 below!
Consider the following language
, which is a subset of :
is the language consisting of all binary strings that have an even number of ’s, an even number of ’s, and the same number of ’s and ’s. Give a CFG that generates .
If your grammar has more than one variable (also called a non-terminal symbol), for each variable, write a short description of the set of strings you expect it to generate.
The following problems are optional and do not need to be submitted. However, you may submit solutions and receive a small amount of extra credit for any 5 (of the 9) subparts, graded solely on completion. For the maximum extra credit score, at least 5 subparts should be submitted, including at least one subpart from each of the three sections.
For each of the following regular languages, construct a regular expression, an FSM, and a CFG.
Nonempty strings over whose digit sums have the same parity as their last digit. That is, if the last digit is even, then the sum of the digits should be even, and if the last digit is odd, then the sum of the digits should be odd.
Binary strings where the difference between the number of 0’s and the number of 1’s is even.
Binary strings that do not contain the substring
00.
Strings over
in which every a is immediately followed by a
b.
Construct CFGs for the following languages (which are not regular).
.
.
Let be a relation on an arbitrary set .
Prove: if is reflexive and transitive, then . (How do you prove set equality?)
Prove: if is symmetric, then is symmetric.
Prove: if and are both equivalence relations on , then is also an equivalence relation on .
Hint: Notice that every string in must have even length, because the number of ’s and the number of ’s are both even. So, we can split a string in into a sequence of two-character blocks, where each block is 00, 01, 10, or 11. What sequences of these blocks can keep both the 0-count and 1-count even?↩︎